<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>数组元素的访问方式</title>
		<script>
			var arr = ['a','b','c','d']
			console.log(arr);
			console.log(arr[0]);
			console.log(arr[1]);
			console.log(arr[2]);
			console.log(arr[3]);
			// console.log(arr[4]);  // undefined
			for(var i=0; i<4; i++ ){
				console.log(arr[i]);
			}
			for(var i=0; i<arr.length; i++ ){
				console.log(arr[i]);
			}
			
			// 在js中不支持像python列表中那样的切片访问
			// console.log(arr[0:2]);
		</script>
	</head>
	<body>
	</body>
</html>